<?php
/**
 * True Gallery back-end batch upload template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename admin.upload.batch.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');


echo JTrueGalleryHTMLHelper::linkJSCalendar(); 

?>
<script type="text/javascript">
function BatchFormCheck( theForm ) {
	if( theForm.zippack.value == '' ) {
		alert('<?php echo JText::_('TG_ZIP_NOT_SELECTED'); ?>');
		return false;
	}
	else if( theForm.catid.value == '0' ) {
		alert('<?php echo JText::_('TG_ONE_ERR'); ?>');
		return false;
	}
	else if( theForm.gentitle.value == '' ) {
		alert('<?php echo JText::_('TG_TWO_ERR'); ?>');
		return false;
	}
	else {
		dgLoading();
	}
}

var xmlhttp;
try { 
	xmlhttp = new XMLHttpRequest();
}
catch(e) {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
		}	
	}
}

function dgLoading() {
	if( !xmlhttp ) return alert("No Http Transport.");
	xmlhttp.open( "GET", document.location.href, true );
	xmlhttp.onreadystatechange = function() {
		if( xmlhttp.readyState == 4 ) {
			document.getElementById("status").innerHTML = '<img src="<?php echo TG_IMAGESWAY; ?>loading.gif" border="0" align="absmiddle">';
		}
	}
	xmlhttp.send( null );
}
</script>
<?php echo JTrueGalleryHTMLHelper::linkJSCalendar(); ?>
<table class="adminheading">
	<tr>
		<th class="tg_adminheader tg_unpack"><?php echo JText::_('TG_BATCH_UPLOAD_TITLE'); ?></th>
	</tr>
</table>

<form action="<?php echo TRUE_INDEX2; ?>&view=upload&task=batch" method="post" name="adminForm" enctype="multipart/form-data" onSubmit="return BatchFormCheck(this)" >
	<table width="100%" border="0" cellpadding="4" cellspacing="2" class="adminform">
		<tr>
			<th><?php echo JText::_('TG_UPLOAD_ZIP'); ?></th>
		</tr>
		<tr>
			<td align="center" valign="top">
				<table border="0">
					<tr>
						<td align="right" width="20%"><b><?php echo JText::_('TG_IMAGE_PACK_FIL'); ?></b></td>
						<td>
							<input type="file" size="34" name="zippack" />
							&nbsp;&nbsp;<?php echo mosToolTip( JText::_('TG_MAX_FILESIZE_1').':<strong>'.ini_get('upload_max_filesize').'</strong>'.JText::_('TG_MAX_FILESIZE_2') ); ?>
						</td>
					</tr>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_GENERIC_TITLE'); ?>:</b></td>
						<td><input type="text" name="gentitle" size="34" maxlength="256">&nbsp;&nbsp;<?php echo mosToolTip( JText::_ ( 'TG_GENERIC_TITLE_BU_I' ) ); ?></td>
					</tr>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_CAT_PHOTO_ASS'); ?>:</b></td>
						<td><?php
						echo $clist.'&nbsp;&nbsp;'.mosToolTip( JText::_ ( 'TG_ALLOWED_CAT' ) ); ?>
						</td>
					</tr><?php
					
				if( $ad_field1 ) {
					?><tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD1'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field1" id="field1" size="34" maxlength="100" value="" />
							<input type="reset" class="button" value="..." onClick="return showCalendar('field1', 'y-mm-dd');">
						</td>
					</tr><?php
				}
				
				if( $ad_field2 ) {
					?><tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD2'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="field2" size="34" maxlength="100" value="" /></td>
					</tr><?php 
				}
				
				if( $ad_field3 ) {
					?><tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD3'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="field3" size="34" maxlength="100" value="" /></td>
					</tr><?php
				}
				
				if( $ad_field4 ) {
					?><tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD4'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="field4" size="34" maxlength="100" value="" /></td>
					</tr><?php
				}
				
				if( $ad_field5 ) {
					?><tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD5'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="field5" size="34" maxlength="100" value="" /></td>
					</tr><?php 
				}
				//echo htmlspecialchars($imgtext, ENT_QUOTES);
					?><tr>
						<td valign="top"><b><?php echo JText::_('TG_GENERIC_DESC'); ?>:</b></td>
						<td><textarea class="inputbox" cols="25" rows="7" name="gendesc"></textarea>&nbsp;&nbsp;<?php echo mosToolTip( JText::_('TG_OPT') ); ?></td>
					</tr>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_AUTHOR'); ?>:</b></td>
						<td><input type="text" name="photocred" size="34" maxlength="256">&nbsp;&nbsp;<?php echo mosToolTip( JText::_('TG_OPT') ); ?></td>
					</tr>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_TAGS'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="tags" size="34" maxlength="100" value="" /></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td colspan="2" align="center">
							<div id="status">
								<input type="submit" value="<?php echo JText::_('TG_UPLOAD'); ?>" class="button" />
							</div>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<!--input type="hidden" name="act" value="<?php echo $act; ?>" /-->
	<input type="hidden" name="option" value="<?php echo TG_CMP; ?>" />
	<input type="hidden" name="task" value="batch" />
	<input type="hidden" name="view" value="upload" />
</form>